home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
By the Book
/
Learn C++ (CodeWarrior)
/
Chap 08.05 - strstream
/
strstream.cp
< prev
next >
Wrap
Text File
|
1995-10-21
|
511b
|
27 lines
#include <iostream.h>
#include <strstream.h>
// Changed the file name from <strstrea.h>
// to <strstream.h> -- Dave Mark, 10/20/95
const short kBufferSize = 10;
//--------------------------------------- main()
int main()
{
char buffer[ kBufferSize ];
ostrstream ostr( buffer, kBufferSize );
short i = 0;
while ( ostr << (char)('a' + i) )
i++;
cout << "Number of characters written: "
<< i << '\n';
buffer[ kBufferSize - 1 ] = '\0';
cout << "Buffer contents: " << buffer;
return 0;
}